<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>约导游</title>
<!--css-->
<link rel="stylesheet" type="text/css" href="css/wutongstyle.css">
</head>

<body>
<!--head begin-->
<%@ include  file="./common/header.jsp"%>
<!--head end--> 
<!--nav end--> 
<!--content begin-->
<div class="wt_content">
  <dl class="yuedaoyou lvxingshe">
    <dt><span><a href="lxslist.jsp">查看更多&gt;&gt;</a></span>旅行社</dt>
    <dd>
      <ul class="indexpic clearfix" id="indexLxsListId">
       
      </ul>
    </dd>
  </dl>
  <dl class="yuedaoyou daoyou">
    <dt><span><a href="dylist.jsp">查看更多&gt;&gt;</a></span>导游</dt>
    <dd>
      <ul class="indexpic clearfix" id="indexGuideListId">
       
      </ul>
    </dd>
  </dl>
</div>
<!--content end-->
<div class="wt_indexinfo clearfix">
  <dl class="wt_indexinfo_why">
    <dt>为什么选择约导游</dt>
    <dd class="price">
      <h4>透明的价格</h4>
      <p>具竞争力的价格 无任何隐形费用</p>
    </dd>
    <dd class="service">
      <h4>优质的服务</h4>
      <p>领先的服务标准 独创的保障体系</p>
    </dd>
  </dl>
  <dl class="wt_indexinfo_line">
    <dt>优秀线路推荐</dt>
    <dd>
      <ul>
   		<li><a href="lxinfo.jsp?teamId=60">黄山2日游</a></li>
        <li><a href="lxinfo.jsp?teamId=61">天堂寨3日游</a></li>
        <li><a href="lxinfo.jsp?teamId=62">淳安千岛湖、龙门古镇、垂云通天河纯玩2日游</a></li>
        <li><a href="lxinfo.jsp?teamId=63">庐山3日游</a></li>
      </ul>
    </dd>
  </dl>
  <dl class="wt_indexinfo_comment">
    <dt>最新导游点评</dt>
    <dd>
      <ul id="recommendGuideListId">
       
      </ul>
    </dd>
  </dl>
</div>
<!--div class="wt_news"></div-->
<!--footer begin-->
<%@ include  file="./common/footer.jsp"%>
<!--footer end--> 


<script type="text/javascript">
var pageIndex=1;
var pageSize=6;

$(function(){
	initIndexLoad();
});

function initIndexLoad(){
	selCity =  getCurrCity();
	loadLxsList();
	loadGuideList();
	loadRecommendGuideList();
}
function loadLxsList(){
	var objp= "{\"pageIndex\":\""+(pageIndex-1)+"\","+
    			"\"pageSize\":\""+pageSize+"\","+
    			"\"city\":\""+selCity+"\""+
    "}";
	$.ajax({
	 url: '${path}/core/getTravelorgListByScore',
	 type: 'POST',
	 timeout: 30000,
	 cache : false,
	 data :objp,
	 async: false,
	 dataType:"json",      
	 contentType:"application/json",   
	// contentType: "application/json; charset=utf-8",
	 success:function(msg){
		  //alert(msg.totalCount)
		  formatLxsList(msg.dataList);
	 },
	  failure:function(msg){
		   alert(eval('('+msg.responseText+')').error_text);
	  		
	  },
	  error:function(msg){
		   alert(eval('('+msg.responseText+')').error_text); 
	  }
	});
}
function formatLxsList(data){
	
  if(data && data.length>0) {
	  $("#indexLxsListId").empty();
	  for(var k=0;k<data.length;k++) {
		  var description = "暂无说明";
		  var site="暂无网址";
		  var siteClick="javascript:void(0)";
		  if(data[k].description!=null && data[k].description!=""){
			  if(data[k].description.length>36){
				  description = data[k].description;
				  description = description.substring(0,36)+"...";
			  }else{
				  description = data[k].description;
			  }
			 
		  }
		  if(data[k].site!=null && data[k].site!=""){
			  site = data[k].site;
			  siteClick = data[k].site;
		  }
		  var registerStatue = "&nbsp;";
		  if(data[k].status==1) {
			  registerStatue="<t class=\"renzheng\">已认证</t>";
		  }
		  $("#indexLxsListId").append("<li>"+
									    "<div class=\"pic\">"+
			  								"<a href=\"lxsinfo.jsp?travelorgId="+data[k].id+"\"><img src=\""+imgDomain+data[k].photo+"\" /></a>"+
			  								"<h3><a href=\"javascript:void(0);\">"+data[k].name+"</a></h3>"+
		  								"</div>"+
									    "<div class=\"txt\">"+
							            "<p><span><a href=\""+siteClick+"\" target=\"_blank\">"+site+"</a></span>"+registerStatue+"</p>"+//+data[k].workyear+

			  								//"<u><span class=\"renzheng\">已认证</span>&nbsp;<a href=\""+siteClick+"\" target=\"_blank\">"+site+"</a></u>"+
			  								description+
		  								"</div>"+
									  "</li>"
		  );
	  }
  }else{
	  $("#indexLxsListId").empty();
	  $("#indexLxsListId").html("暂无数据");
  }
}
function loadGuideList(){
	var objp= "{\"pageIndex\":\""+(pageIndex-1)+"\","+
    			"\"pageSize\":\""+pageSize+"\","+
    			"\"city\":\""+selCity+"\""+
    "}";
	$.ajax({
	 url: '${path}/core/getGuideListByScore',
	 type: 'POST',
	 timeout: 30000,
	 cache : false,
	 data :objp,
	 async: false,
	 dataType:"json",      
	 contentType:"application/json",   
	// contentType: "application/json; charset=utf-8",
	 success:function(msg){
		  //alert(msg.totalCount)
		  formatGuideList(msg.dataList);
		  formatGuideNew(msg.dataList);
	 },
	  failure:function(msg){
		   alert(eval('('+msg.responseText+')').error_text);
	  		
	  },
	  error:function(msg){
		   alert(eval('('+msg.responseText+')').error_text); 
	  }
	});
}
function loadRecommendGuideList(){
	var objp= "{\"pageIndex\":\""+(pageIndex-1)+"\","+
    			"\"pageSize\":\""+pageSize+"\""+
    "}";
	$.ajax({
	 url: '${path}/core/getGuideListByScore',
	 type: 'POST',
	 timeout: 30000,
	 cache : false,
	 data :objp,
	 async: false,
	 dataType:"json",      
	 contentType:"application/json",   
	// contentType: "application/json; charset=utf-8",
	 success:function(msg){
		  //alert(msg.totalCount)
		  formatGuideNew(msg.dataList);
	 },
	  failure:function(msg){
		   alert(eval('('+msg.responseText+')').error_text);
	  		
	  },
	  error:function(msg){
		   alert(eval('('+msg.responseText+')').error_text); 
	  }
	});
}
function formatGuideNew(data){    
	if(data && data.length>=4) {
    $("#recommendGuideListId").empty();
    var cindex=0;
    for(var k=0;k<4;k++) {
           if(data[k].id==19 ||data[k].id==20) {
    }else{
       if(cindex<2) {
       $("#recommendGuideListId").append("<li><a href=\"dyinfo.jsp?guideId="+data[k].id+"\"><img src=\""+imgDomain+data[k].photo+"\" /></a>"+
                                                                                  "<a href=\"dyinfo.jsp?guideId="+data[k].id+"\"><b>"+data[k].name+"</b></a><span>一级导游</span>"+
                                                                           " <p>这个导游非常相当不错，形象好气质佳~</p>"+
                                                                            "</li>"
                 );
          cindex=cindex+1;
       }else{
              break;
        }
    } 
 }
}
}
function formatGuideList(data){
	  if(data && data.length>0) {
		  $("#indexGuideListId").empty();
		  for(var k=0;k<data.length;k++) {
			  var workyear=1;
			  var description="暂无说明";
			  if(data[k].workyear!=null && data[k].workyear!=""){
				  workyear = data[k].workyear;
			  }
			  if(data[k].description!=null && data[k].description!=""){
				  if(data[k].description.length>36){
					  description = data[k].description;
					  description = description.substring(0,36)+"...";
				  }else{
					  description = data[k].description;
				  }
			  }
			  var registerStatue = "&nbsp;";
			  if(data[k].status==1) {
				  registerStatue="<t class=\"renzheng\">已认证</t>";
			  }
			  $("#indexGuideListId").append("<li>"+
									          "<div class=\"pic\">"+
			                                       "<a href=\"dyinfo.jsp?guideId="+data[k].id+"\"><img src=\""+imgDomain+data[k].photo+"\" /></a>"+
			                                       "<span class=\"bg\"></span>"+
			                                       "<span class=\"tt\"><a href=\"javascript:void(0)\">"+data[k].name+"</a></span>"+
			                                  "</div>"+
									          "<div class=\"txt\">"+
									            "<p><span>从业<b>"+workyear+"</b>年</span>"+registerStatue+"</p>"+//+data[k].workyear+
									            description+
									          "</div>"+
									        "</li>"
			
			  );
		  }
	  }else{
		  $("#indexGuideListId").empty();
		  $("#indexGuideListId").html("暂无数据");
	  }
}

</script>
</body>
</html>
